

package jetbrains.buildServer.server.rest.model.versionedSettings;


import java.util.*;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jetbrains.buildServer.server.rest.swagger.annotations.ModelBaseType;
import jetbrains.buildServer.server.rest.swagger.annotations.ModelDescription;
import jetbrains.buildServer.server.rest.swagger.constants.ObjectType;
import org.jetbrains.annotations.NotNull;


@XmlRootElement(name = "versionedSettingsContextParameters")
@ModelDescription(
  value = "Represents a Versioned Settings Context Parameters.",
  externalArticleLink = "https://www.jetbrains.com/help/teamcity/storing-project-settings-in-version-control.html",
  externalArticleName = "Storing Project Settings in Version Control"
)
@ModelBaseType(ObjectType.LIST)
public class VersionedSettingsContextParameters {

  private List<VersionedSettingsContextParameter> myParameters;


  @SuppressWarnings("unused")
  public VersionedSettingsContextParameters() {
  }


  public VersionedSettingsContextParameters(@NotNull List<VersionedSettingsContextParameter> parameters) {
    myParameters = parameters;
  }


  public Map<String, String> toMap() {
    Map<String, String> result = new HashMap<>();
    myParameters.forEach(parameter -> result.put(parameter.getName(), parameter.getValue()));
    return result;
  }

  @XmlElement(name = VersionedSettingsContextParameter.TYPE)
  @NotNull
  public List<VersionedSettingsContextParameter> getParameters() {
    return myParameters;
  }

  public void setParameters(List<VersionedSettingsContextParameter> parameters) {
    myParameters = parameters;
  }

}